package main

import (
	"github.com/cloudwego/hertz/pkg/app/server"
	"github.com/hertz-contrib/logger/accesslog"
	"login/src/conf"
	"login/src/core/db"
	"login/src/core/log"
	"login/src/core/middleware"
	"login/src/core/utils/jwt"
	"login/src/routers"
	"login/src/services"
)

func main() {
	conf.Init()
	log.Init()
	db.Init()
	jwt.Init()
	services.Init()

	h := server.Default(server.WithHostPorts(conf.GetConf().Server.Address))
	h.Use(accesslog.New(accesslog.WithFormat(conf.GetConf().Log.AccessLogFmt)))
	h.Use(middleware.HeaderMiddleware())
	routers.Register(h)
	h.Spin()

}
